class Element:
    def __init__(self):
        self.number_of_dof = 0
        self.stiffness = None
        self.element_nodes = []

class RodElement(Element):

    def __init__(self, element_id, youngs_modulus, area, length, element_nodes):
        self.element_id = element_id
        self.element_nodes = element_nodes
        self.youngs_modulus = youngs_modulus
        self.area = area
        self.length = length
        self.number_of_dof = 2
        self.set_stiffness()
        
    def print_debug_info(self):
        print "Element Type: Rod"
        print ""
        print "element id: " + str(self.element_id)
        print ""
        print "element node 1 id: " + str(self.element_nodes[0].node_id)
        print "element node 2 id: " + str(self.element_nodes[1].node_id)
        print ""
        print "element stiffness = " + str(self.stiffness)
        print "" 

    def set_stiffness(self):
        self.stiffness = ([-self.youngs_modulus*self.area/self.length,  self.youngs_modulus*self.area/self.length], \
                          [ self.youngs_modulus*self.area/self.length, -self.youngs_modulus*self.area/self.length])
        

    
